﻿using System.Collections.Generic;
using FairyGUI;

public class MyUIPackage
{
    /// <summary>
    /// 获取指定包内的所有图片
    /// </summary>
    /// <param name="package">包名，默认获取所有包</param>
    /// <returns></returns>
    public static List<PackageItem> GetAllPointAssets(string package = "",PackageItemType itemType = PackageItemType.Image)
    {
        var assets = new List<PackageItem>();
        var packages = UIPackage.GetPackages();
        for (int i = 0; i < packages.Count; i++)
        {
            if (package != "" && packages[i].name != package) continue;
            var items = packages[i].GetItems();
            for(int j = 0;j < items.Count; j++)
            {
                if(items[j].type == itemType)
                {
                    assets.Add(items[j]);
                }
            }
        }
        return assets;
    }
}
